package com.bcnapps.DemoGame;

import android.graphics.Canvas;
import android.graphics.Paint;

public class Base {
	
	//posicio
	public float x;
	public float y;
	//tamany
	public float tx;
	public float ty;
	//draw options
	Paint paint;
	
	public Base() {
		tx = ((float)GV.Screen.metrics.widthPixels*0.2f);
		ty = ((float)GV.Screen.metrics.heightPixels*0.05f);
		x = ((float)GV.Screen.metrics.widthPixels/2) - (tx/2);
		y = (float)GV.Screen.metrics.heightPixels - 2*ty;
		paint = new Paint();
		paint.setColor(0xFF000000);
		paint.setStyle(Paint.Style.FILL);
	}
	
	public void Draw(Canvas canvas) {
		canvas.drawRect(x, y, x+tx, y+ty, paint);
	}
	
	public void actualitzaPos(float dx) {
		x += (float)GV.Screen.metrics.widthPixels * 0.08f * dx;
		if(x<0) x = 0;
		if(x > (float)GV.Screen.metrics.widthPixels - tx) x = (float)GV.Screen.metrics.widthPixels-tx;
	}
}
